package com.itheima.enhanser;



import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
//
@Aspect
public class MyEnhancer {

    /*@Before("execution(* com.itheima.service.*.*.*(..))")
    public void before() {
        System.out.println("前置方法 执行");
    }

    @AfterReturning("execution(* com.itheima.service.*.*.*(..))")
    public void afterReturing() {
        System.out.println("后置方法 执行");
    }
*/
    @Around("execution(* com.itheima.service.*.*.*(..))")
    public void around(ProceedingJoinPoint pjp) {

            System.out.println("环绕通知");

            Object returnData = null;

        try {

            System.out.println("前置通知");

            returnData = pjp.proceed();

            System.out.println("后置通知");
        } catch (Throwable throwable) {


            System.out.println("异常通知");

        } finally {

            System.out.println("最终通知");

        }

    }

}
